package com.itheima.search.mapper;

import com.github.pagehelper.Page;
import com.itheima.search.model.entity.QueryPageBean;
import com.itheima.search.model.pojo.CheckGroup;
import com.itheima.search.model.pojo.CheckItem;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Lee
 * @created 2024/5/10
 * @describtion
 */
@Mapper
public interface CheckgroupMapper {
    // 新增检查组
    @Insert("insert into t_checkgroup(code,name,helpCode,sex,remark,attention) " +
            "values (#{code},#{name},#{helpCode},#{sex},#{remark},#{attention})")
    void save(CheckGroup checkGroup);


    @Insert("insert into t_checkitem values ( null,#{code}, #{name}, #{sex}, #{age}, #{price}, #{type}, #{remark}, #{attention})")
    @Options(useGeneratedKeys = true, keyProperty = "id")
    void addItems(List<CheckItem> checkItems);


    @Insert("insert into t_checkgroup_checkitem values (#{checkGroupId},#{checkItemId})")
    void addGroupIdAndItemsId(Integer checkGroupId, Integer checkItemId);

    Page<CheckGroup> page(QueryPageBean queryPageBean);
}
